<html>
<head><meta charset="utf-8"><title>PowerPC C ABI fixes PR #64259 · t-compiler · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/index.html">t-compiler</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/PowerPC.20C.20ABI.20fixes.20PR.20.2364259.html">PowerPC C ABI fixes PR #64259</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="180145845"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/PowerPC%20C%20ABI%20fixes%20PR%20%2364259/near/180145845" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/PowerPC.20C.20ABI.20fixes.20PR.20.2364259.html#180145845">(Nov 07 2019 at 15:57)</a>:</h4>
<p>to be frank I have no clue what's going on with this PR</p>



<a name="180145854"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/PowerPC%20C%20ABI%20fixes%20PR%20%2364259/near/180145854" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/PowerPC.20C.20ABI.20fixes.20PR.20.2364259.html#180145854">(Nov 07 2019 at 15:57)</a>:</h4>
<p><span class="user-mention" data-user-id="119009">@eddyb</span> can you clue us (or me) in ?</p>



<a name="180145879"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/PowerPC%20C%20ABI%20fixes%20PR%20%2364259/near/180145879" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/PowerPC.20C.20ABI.20fixes.20PR.20.2364259.html#180145879">(Nov 07 2019 at 15:58)</a>:</h4>
<p>I think this should land.</p>



<a name="180145926"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/PowerPC%20C%20ABI%20fixes%20PR%20%2364259/near/180145926" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/PowerPC.20C.20ABI.20fixes.20PR.20.2364259.html#180145926">(Nov 07 2019 at 15:58)</a>:</h4>
<p>the first commit was factored out. But <span class="user-mention" data-user-id="123586">@nagisa</span> , you're saying the whole thing should also land?</p>



<a name="180145932"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/PowerPC%20C%20ABI%20fixes%20PR%20%2364259/near/180145932" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/PowerPC.20C.20ABI.20fixes.20PR.20.2364259.html#180145932">(Nov 07 2019 at 15:58)</a>:</h4>
<p>I've stalled the PR originally because the author generalized some existing checks for targets that have weird ZST behavior</p>



<a name="180145955"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/PowerPC%20C%20ABI%20fixes%20PR%20%2364259/near/180145955" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/PowerPC.20C.20ABI.20fixes.20PR.20.2364259.html#180145955">(Nov 07 2019 at 15:58)</a>:</h4>
<p>(first commit factored PR is "Fix C aggregate-passing ABI on powerpc" <a href="https://github.com/rust-lang/rust/issues/66050" target="_blank" title="https://github.com/rust-lang/rust/issues/66050">#66050</a>)</p>



<a name="180145973"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/PowerPC%20C%20ABI%20fixes%20PR%20%2364259/near/180145973" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/PowerPC.20C.20ABI.20fixes.20PR.20.2364259.html#180145973">(Nov 07 2019 at 15:58)</a>:</h4>
<p>I'm not opposed to adding PPC32 as another special-case for the weird ZST behavior</p>



<a name="180146038"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/PowerPC%20C%20ABI%20fixes%20PR%20%2364259/near/180146038" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/PowerPC.20C.20ABI.20fixes.20PR.20.2364259.html#180146038">(Nov 07 2019 at 15:59)</a>:</h4>
<p>I've spent some time with <span class="user-mention" data-user-id="132920">@gnzlbg</span> discussing the overall behavior in GCC and they've opened some bug reports for GCC, I think, but I don't know what the status of that is</p>



<a name="180146128"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/PowerPC%20C%20ABI%20fixes%20PR%20%2364259/near/180146128" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/PowerPC.20C.20ABI.20fixes.20PR.20.2364259.html#180146128">(Nov 07 2019 at 16:00)</a>:</h4>
<p>I feel that this PR has a couple of contention points</p>



<a name="180146151"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/PowerPC%20C%20ABI%20fixes%20PR%20%2364259/near/180146151" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/PowerPC.20C.20ABI.20fixes.20PR.20.2364259.html#180146151">(Nov 07 2019 at 16:00)</a>:</h4>
<p>The status of PPC32 is that is a target that nobody uses</p>



<a name="180146164"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/PowerPC%20C%20ABI%20fixes%20PR%20%2364259/near/180146164" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/PowerPC.20C.20ABI.20fixes.20PR.20.2364259.html#180146164">(Nov 07 2019 at 16:00)</a>:</h4>
<p>nobody is responsible for its ABI</p>



<a name="180146173"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/PowerPC%20C%20ABI%20fixes%20PR%20%2364259/near/180146173" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/PowerPC.20C.20ABI.20fixes.20PR.20.2364259.html#180146173">(Nov 07 2019 at 16:00)</a>:</h4>
<p>better not touch it and break things</p>



<a name="180146185"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/PowerPC%20C%20ABI%20fixes%20PR%20%2364259/near/180146185" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/PowerPC.20C.20ABI.20fixes.20PR.20.2364259.html#180146185">(Nov 07 2019 at 16:01)</a>:</h4>
<p>so what is PR author's motivation then?</p>



<a name="180146187"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/PowerPC%20C%20ABI%20fixes%20PR%20%2364259/near/180146187" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/PowerPC.20C.20ABI.20fixes.20PR.20.2364259.html#180146187">(Nov 07 2019 at 16:01)</a>:</h4>
<p>oh you mean on GCC's side?</p>



<a name="180146208"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/PowerPC%20C%20ABI%20fixes%20PR%20%2364259/near/180146208" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/PowerPC.20C.20ABI.20fixes.20PR.20.2364259.html#180146208">(Nov 07 2019 at 16:01)</a>:</h4>
<ol>
<li>There is a generalization to no longer check for <code>-gnu</code> abi when applying this hack etc.</li>
</ol>



<a name="180146213"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/PowerPC%20C%20ABI%20fixes%20PR%20%2364259/near/180146213" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/PowerPC.20C.20ABI.20fixes.20PR.20.2364259.html#180146213">(Nov 07 2019 at 16:01)</a>:</h4>
<p>for ZSTs, the ABI spec of PPC32 is "weird", but that's how it is</p>



<a name="180146247"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/PowerPC%20C%20ABI%20fixes%20PR%20%2364259/near/180146247" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/PowerPC.20C.20ABI.20fixes.20PR.20.2364259.html#180146247">(Nov 07 2019 at 16:01)</a>:</h4>
<p>hmm</p>



<a name="180146249"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/PowerPC%20C%20ABI%20fixes%20PR%20%2364259/near/180146249" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/PowerPC.20C.20ABI.20fixes.20PR.20.2364259.html#180146249">(Nov 07 2019 at 16:01)</a>:</h4>
<p>actually</p>



<a name="180146252"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/PowerPC%20C%20ABI%20fixes%20PR%20%2364259/near/180146252" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/PowerPC.20C.20ABI.20fixes.20PR.20.2364259.html#180146252">(Nov 07 2019 at 16:01)</a>:</h4>
<p>we are now over time</p>



<a name="180146261"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/PowerPC%20C%20ABI%20fixes%20PR%20%2364259/near/180146261" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/PowerPC.20C.20ABI.20fixes.20PR.20.2364259.html#180146261">(Nov 07 2019 at 16:01)</a>:</h4>
<p>so lets move this discussion into a dedicated separate topic</p>



<a name="180146347"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/PowerPC%20C%20ABI%20fixes%20PR%20%2364259/near/180146347" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/PowerPC.20C.20ABI.20fixes.20PR.20.2364259.html#180146347">(Nov 07 2019 at 16:02)</a>:</h4>
<p>one thing I wanted to suggest during the discussion on the PR was that we "just" drop ZST support in FFI and warn about it - but <span class="user-mention" data-user-id="239881">@Josh Triplett</span> pointed out to me that it can arise from C code with <code>#ifdef</code>s around struct fields</p>



<a name="180146356"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/PowerPC%20C%20ABI%20fixes%20PR%20%2364259/near/180146356" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/PowerPC.20C.20ABI.20fixes.20PR.20.2364259.html#180146356">(Nov 07 2019 at 16:02)</a>:</h4>
<blockquote>
<p>For the 32-bit ELF ABI, all structs (regardless of size) are passed using a pointer allowing for call-by-value semantics.  This is the source of ZSTs requiring a register.  So it's clear there is an ABI that requires this behavior.  (Look for the Parameter Passing Register Selection Algorithm in <a href="https://github.com/ryanarn/powerabi/blob/master/chap3-elf32abi.sgml" target="_blank" title="https://github.com/ryanarn/powerabi/blob/master/chap3-elf32abi.sgml">https://github.com/ryanarn/powerabi/blob/master/chap3-elf32abi.sgml</a>.)</p>
</blockquote>



<a name="180146382"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/PowerPC%20C%20ABI%20fixes%20PR%20%2364259/near/180146382" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/PowerPC.20C.20ABI.20fixes.20PR.20.2364259.html#180146382">(Nov 07 2019 at 16:02)</a>:</h4>
<p>(My only real thought here is that we should just decide <em>something</em>, and I lean towards more conservative choices for now, e.g. extending a list of special cases, perhaps with a comment that says "we might consider genearlizing this to a rule like such-and-such" so that we notice it in the future as we add more)</p>



<a name="180146442"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/PowerPC%20C%20ABI%20fixes%20PR%20%2364259/near/180146442" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/PowerPC.20C.20ABI.20fixes.20PR.20.2364259.html#180146442">(Nov 07 2019 at 16:03)</a>:</h4>
<p>I don’t have time to contribute to this discussion, gotta go walk my quadruped friend, but my broad desire to land something here stays. I don’t see much harm in generalizing over gnu&amp;musl.</p>



<a name="180146619"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/PowerPC%20C%20ABI%20fixes%20PR%20%2364259/near/180146619" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/PowerPC.20C.20ABI.20fixes.20PR.20.2364259.html#180146619">(Nov 07 2019 at 16:05)</a>:</h4>
<p>I might be fine with an approach where we derive the "ZSTs aren't passed" behavior without having to up-front force it, but it may be tricky to ensure that it "fall out" of the general logic for all targets (and testing here is annoying, I'd prefer formal proofs at this point...)</p>



<a name="180146659"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/PowerPC%20C%20ABI%20fixes%20PR%20%2364259/near/180146659" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/PowerPC.20C.20ABI.20fixes.20PR.20.2364259.html#180146659">(Nov 07 2019 at 16:05)</a>:</h4>
<p>the check for that might need to happen, especially for the <code>sparc</code> branch, which is the only one which has actual ABIs that aren’t "GNU".</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>